﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
   
    protected void Btn_Login_Click(object sender, EventArgs e)
    {
        if (Txb_LoginName.Text.ToString() == "")
        {
            this.RegisterStartupScript("Msg", "<script>alert('请输入登录邮箱')</script>");
            return;
        }

        if (Txb_Pwd.Text.ToString() == "")
        {
            this.RegisterStartupScript("Msg", "<script>alert('请输入密码')</script>");
            return;
        }

        UserMemberService.UserMemberService oService = new UserMemberService.UserMemberService();

        string strRst = oService.UserLogin(Txb_LoginName.Text.ToString(), Txb_Pwd.Text.ToString());

        if (strRst == "输入的登录用户或者密码不正确")
        {
            this.RegisterStartupScript("Msg", "<script>alert('输入的登录用户或者密码不正确')</script>");
            return;
        }
        else
        {
            Session["UserID"] = strRst;
            Session["LoginName"] = Txb_LoginName.Text.ToString();
            Session["Pwd"] = Txb_Pwd.Text.ToString();

            Response.Redirect("Search.aspx");
        }

    }
    protected void Btn_Register_Click(object sender, EventArgs e)
    {
        Response.Redirect("Register.aspx");
    }
}
